package com.yuxin.tongyi.lsll.service;

import com.yuxin.tongyi.lsll.common.NetworkStateBroadcast;

import android.app.Service;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.os.IBinder;
/**
 * 
 * @author daijin'ge
 * 2012-4-17
 * 注册监听网络状态改变的广播
 */
public class NetworkListenerService extends Service {
	
	private NetworkStateBroadcast mNetworkStateReceiver;
	
	@Override
	public IBinder onBind(Intent arg0) {
		// TODO Auto-generated method stub
		return null;
	}
	
    @Override
    public void onCreate() {
        super.onCreate();
        mNetworkStateReceiver = new NetworkStateBroadcast();
        IntentFilter filter = new IntentFilter();
		filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
		registerReceiver(mNetworkStateReceiver, filter);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        unregisterReceiver(mNetworkStateReceiver);
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return super.onStartCommand(intent, flags, startId);
    }
	
}
